<?php
class index extends admin{
    
    public function __construct(){
        parent::__construct();
    }
    
    public function index(){
       $tpl=$this->Template();
       $tpl->display('index');
        
    }
    
    //获取后台菜单
    public function getmenu(){
        /*
        if($_SESSION['admin']['id']==1){
           $data=db()->getAll('select * from x_menu where is_menu=1 and status=1 order by sort DESC');
        }
        else if(!empty($_SESSION['admin']['menu_ids'])){
           $data=db()->getAll('select * from x_menu where is_menu=1 and status=1 and id in('.$_SESSION['admin']['menu_ids'].') order by sort DESC');
        }
        if($data) exit(json_encode(getTree($data,0)));
        else exit(0);*/
        $menu=[
        [id=>1,name=>'教练管理',parentid=>0,route=>'',view=>'',icon=>'icon-coach'],
           [id=>2,name=>'教练列表',parentid=>1,route=>'coach',view=>'coach'],
           [id=>3,name=>'请假记录',parentid=>1,route=>'leave',view=>'leave'],
        [id=>4,name=>'学员管理',parentid=>0,route=>'',view=>'',icon=>'icon-xueyuan'],
           [id=>5,name=>'学员列表',parentid=>4,route=>'user',view=>'user'],
           [id=>6,name=>'考试预约',parentid=>4,route=>'exam',view=>'exam'],
           [id=>16,name=>'约车记录',parentid=>4,route=>'exam',view=>'exam'],
        [id=>7,name=>'财务管理',parentid=>0,route=>'',view=>'',icon=>'icon-qiandai'],
           [id=>8,name=>'提现列表',parentid=>7,route=>'withdraw',view=>'withdraw'],
           [id=>9,name=>'订单列表',parentid=>7,route=>'order',view=>'order'],
        [id=>10,name=>'报名管理',parentid=>0,route=>'baoming',view=>'baoming',icon=>'icon-shuju'],
        [id=>14,name=>'车辆',parentid=>0,route=>'jxbus',view=>'car',icon=>'icon-cheliang'],
        [id=>11,name=>'扩展',parentid=>0,route=>'',view=>'',icon=>'icon-expand'],
           [id=>16,name=>'驾校管理',parentid=>11,route=>'',view=>''],
           [id=>18,name=>'套餐管理',parentid=>11,route=>'taocan',view=>'taocan'],
           [id=>12,name=>'评价管理',parentid=>11,route=>'comment',view=>'comment'],
           [id=>15,name=>'优惠券',parentid=>11,route=>'',view=>''],
         [id=>17,name=>'系统',parentid=>0,route=>'',view=>'',icon=>'icon-expand'],
            [id=>18,name=>'用户管理',parentid=>17,route=>'',view=>''],
            [id=>19,name=>'系统日志',parentid=>17,route=>'syslog',view=>'syslog'],
        ];
        $this->ajaxReturn(array('status'=>1,'data'=>$menu));
    }
    
    public function logout(){
        unset($_SESSION['admin']);
        //header('location:/login');
        $this->ajaxReturn(array('status'=>1));
    }

    public function search(){
      echo json_encode(array('status'=>1,'info'=>$_SESSION));
    }
}